package com.geek.netty.test;


/**
 * @program netty-server
 * @description: linked
 * @author: chanzhugang
 * @create: 2021/08/20 19:43
 */
public class LinkedList<I extends Number> extends java.util.LinkedList {

    // 双向链表 、 往指定位置添加节点


    // 定义节点
    static class Node {
        Integer data;

        Node next;

        Node prev;

        public Node(Integer data) {
            this.data = data;
        }
    }

    Node head;


    public void insert(int index, int value) {
        Node p = head;

        int pos = 0;

        while (p != null) {
            pos++;
            p = p.next;

        }
        if (pos == index) {
            Node node = new Node(value);
            node.next = p.next;
            p.next = node;
        }

    }
}